package com.chelsea;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.Vector;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class Screen{

	PicturePanel picPanel;
	TagPanel tagPanel;
	NamePanel namePanel;
	JFrame frame;
	
	
	public void buildUI(){
		frame = new JFrame();
		JPanel panel = new JPanel();
		panel.setPreferredSize(new Dimension(600,400));
		panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
		picPanel = new PicturePanel(this);
		tagPanel = new TagPanel(this);
		namePanel = new NamePanel(this);
	
		panel.add(picPanel);
		panel.add(namePanel);
		//panel.add(tagPanel);
		BorderLayout layout = new BorderLayout(0,0);
		frame.setLayout(layout);
		//frame.getLayout().
		frame.add(panel);
	//	frame.add(BorderLayout.EAST, namePanel);
		frame.add(BorderLayout.SOUTH, tagPanel);
		frame.setSize(600, 600);
		frame.setVisible(true);
	}

	

	public void addTag(int x, int y) {
		// TODO Auto-generated method stub
		picPanel.drawSquare(x, y);
		String tagName = JOptionPane.showInputDialog("Enter Name of Tag: ");
		picPanel.endTagAddingEvent();
		tagPanel.addTag(tagName, x, y);
		picPanel.hideSquare();
		
		
	}
	
	public void viewTagByClick(Tag tag){
		picPanel.displayTagByClick(tag);
	}
	
	public Tag viewTagByHover(int x, int y, int tagSize){
		return tagPanel.findTags(x, y, tagSize);
	}

	
	
	
}
